package com.threeonemeeting.activity;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.threeonemeeting.R;
import com.threeonemeeting.tab.BaseTabActivity;

public class AboutUsActivity extends BaseTabActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ac_about);
		init("关于我们");
		
		TextView tx = (TextView)findViewById(R.id.loading_text);
		if( tx != null){
			tx.setText("正在加载页面，请稍候...");
		}

		final LinearLayout loadingLayout = (LinearLayout) findViewById(R.id.loading_layout);
		final LinearLayout webViewLayout = (LinearLayout) findViewById(R.id.webview_layout);
		loadingLayout.setVisibility(View.VISIBLE);
		webViewLayout.setVisibility(View.GONE);

		final WebView webview = (WebView) findViewById(R.id.web);
		webview.getSettings().setJavaScriptEnabled(true);
		webview.getSettings().setAllowFileAccess(true);
		webview.getSettings().setSupportZoom(true);
		webview.getSettings().setBuiltInZoomControls(true);//设置支持缩放
		webview.setVerticalScrollBarEnabled(false);
		webview.setWebViewClient(new WebViewClient() {

			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				view.loadUrl(url);
				return true;
			}

			@Override
			public void onPageStarted(WebView view, String url, Bitmap favicon) {
				super.onPageStarted(view, url, favicon);
				loadingLayout.setVisibility(View.VISIBLE);
			}

			// 页面加载完毕了
			public void onPageFinished(android.webkit.WebView view,
					java.lang.String url) {

				loadingLayout.setVisibility(View.GONE);
				webViewLayout.setVisibility(View.VISIBLE);
			}
		});

		webview.loadUrl("http://corp.31huiyi.com/at/about.html");
	}
}
